<template>
    <div class="life-weather">
        <el-table
            :data="weatherData"
            style="width: 100%"
            >
            <el-table-column
            prop="city"
            label="城市"
            width="250">
            </el-table-column>
            
            <el-table-column
            label="操作"
            width="220">
            <template slot-scope="scope">
                <el-button
                @click.native.prevent="deleteCity(scope.$index, weatherData)"
                type="text"
                size="small"
                style="color: #4065E0">
                删除
                </el-button>
            </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
export default {
    name: 'Weather',
    data() {
        return {
            weatherData: [
                { city: '上海普陀区' }
            ]
        }
    },
    methods: {
        deleteCity(index, rows){
            rows.splice(index, 1);
        }
    }
}
</script>

<style lang="scss" scoped>
.life-weather{
    margin-top: 20px;
}
</style>
